﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Ini;

namespace TwipPlays
{
    public partial class Environment : Form
    {
        public Environment()
        {
            InitializeComponent();

            // Initialize values
            IniFile ini = new IniFile("irc_parser/config.ini");

            string windowName = ini.IniReadValue("environment", "windowName");

            int keyDelay;
            string keyDelayStr = ini.IniReadValue("environment", "keyDelay");
            int.TryParse(keyDelayStr, out keyDelay);

            this.window_name_entry.Text = windowName;
            this.input_delay_spin.Value = keyDelay;

        }

        private void save_clicked(object sender, EventArgs e)
        {

            // Initialize values
            IniFile ini = new IniFile("irc_parser/config.ini");

            ini.IniWriteValue("environment", "windowName", this.window_name_entry.Text);
            ini.IniWriteValue("environment", "keyDelay", this.input_delay_spin.Value.ToString());

            this.Close();

        }

        private void cancel_clicked(object sender, EventArgs e)
        {

            this.Close();

        }

    }

}
